package com.example.imoocmusicdemo.activitys;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.imoocmusicdemo.R;

public class MoreActivity extends BaseActivity {

    private TextView exit;

    private LinearLayout changePwd;
    private TextView deleteU;
    TextView broadCast;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_more);

        deleteU = fd(R.id.delete);
        broadCast = fd(R.id.broad);

        deleteU.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent in=new Intent(MoreActivity.this,DeleteUser.class);

                startActivity(in);
                finish();
            }
        });

        broadCast.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i=new Intent(MoreActivity.this,broadCastReceiver.class);

                startActivity(i);
                finish();
            }
        });

        loginOut();

        onClick();
        init();
    }



    private void onClick() {
        changePwd = fd(R.id.change_pwd);

        changePwd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i=new Intent(MoreActivity.this,ChangePwd.class);

                startActivity(i);
                finish();
            }
        });
    }

    private void loginOut() {
        exit = fd(R.id.exit);
        exit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction("android.intent.action.LoginActivity");
                Toast.makeText(MoreActivity.this, "退出成功！", Toast.LENGTH_SHORT).show();
                startActivity(intent);
            }
        });
    }

    private void init() {
        initNavBar(true,"",false);
    }







}